package com.fenggo.platform.account.rest;

import com.fenggo.platform.account.client.OrderingServiceClient;
import com.fenggo.platform.account.client.ProductionServiceClient;
import com.fenggo.platform.account.dto.OrderRequestDTO;
import com.fenggo.platform.account.dto.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private OrderingServiceClient orderingServiceClient;

    @Autowired
    private ProductionServiceClient productionServiceClient;

    @GetMapping(value = "/user")
    public ResultDTO userInfo(){
        return ResultDTO.builder().data("hello world").build();
    }

    @GetMapping("/product")
    public ResultDTO productInfo(){
        ResultDTO remoteResp = orderingServiceClient.createOrder();
        return ResultDTO.builder().data(remoteResp.getData()).build();
    }

    @GetMapping("/order")
    public ResultDTO orderInfo (){
        ResultDTO remoteResp = productionServiceClient.findAll();
        return ResultDTO.builder().data(remoteResp.getData()).build();
    }
}
